/*
 * @Author: qwlbwm 18370818801qwl./
 * @Date: 2023-09-06 20:24:34
 * @LastEditors: qwlbwm 18370818801qwl./
 * @LastEditTime: 2023-09-15 12:33:03
 * @FilePath: \checc-business-module-web-kgpt-dev\src\views\examineManage\utils.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

const pubFc = {
    ojectCopyObj(targetObj: any, sourceObj: any, noObj: any = {}) {
        for (const key in targetObj) {
          if (!noObj[key]) {
            targetObj[key] = (sourceObj[key] || sourceObj[key] == 0) ? sourceObj[key] : '';
          }
    
        }
      },
      downloadFunc(data,headers){
        const fileName = headers["content-disposition"].replace(/\w+;filename=(.*)/, "$1");
        const blob = new Blob([data as any], { type: headers["content-type"] });
        const dom = document.createElement("a");
        const url = window.URL.createObjectURL(blob);
        dom.href = url;
        dom.download = decodeURI(fileName);
        dom.style.display = "none";
        document.body.appendChild(dom);
        dom.click();
        dom.parentNode?.removeChild(dom);
        window.URL.revokeObjectURL(url);
      }
}
export default pubFc;